﻿@page "/cars_manager/info"
@using Gardener.Application.Dtos
<div>
    <PageContainer Title="">
        <Breadcrumb>
            <Breadcrumb>
                <BreadcrumbItem>车辆管理</BreadcrumbItem>
                <BreadcrumbItem>车辆信息</BreadcrumbItem>
            </Breadcrumb>
        </Breadcrumb>
        <ChildContent>
            <Table @ref="_table"
                   TItem="CarDto"
                   DataSource="@_cars"
                   Total="_total"
                   OnChange="@onChange"
                   @bind-PageIndex="_pageIndex"
                   @bind-PageSize="_pageSize"
                   @bind-SelectedRows="_selectedRows"
                   Loading="@_tableIsLoading"
                   Context="model">
                <TitleTemplate>
                    <Row>
                        <AntDesign.Col Span="8">
                            <ResourceAuthorize ResourceKey="cars_manager_info_delete_selected">
                                <Button Type="@ButtonType.Primary" Icon="delete" Danger OnClick="OnDeletesClick">
                                    删除选中
                                </Button>
                            </ResourceAuthorize>
                        </AntDesign.Col>
                        <AntDesign.Col Span="16" Style="text-align:right">
                            <Space>
                                <ResourceAuthorize ResourceKey="cars_manager_info_add">
                                    <SpaceItem>
                                        <Button Type="@ButtonType.Primary" Icon="plus" OnClick="OnAddClick">
                                            添加
                                        </Button>
                                    </SpaceItem>
                                </ResourceAuthorize>
                                <ResourceAuthorize ResourceKey="cars_manager_info_refresh">
                                    <SpaceItem>
                                        <Button Type="@ButtonType.Primary" Icon="reload" OnClick="OnReLoadTable">
                                            刷新
                                        </Button>
                                    </SpaceItem>
                                </ResourceAuthorize>
                            </Space>
                        </AntDesign.Col>
                    </Row>
                </TitleTemplate>
                <RowTemplate>
                    <ResourceAuthorize ResourceKey="cars_manager_info_delete_selected">
                        <Selection Key="@(model.Id.ToString())" />
                    </ResourceAuthorize>
                    <Column Title="编号" @bind-Field="@model.Id" Sortable />
                    <Column Title="车牌号" @bind-Field="@model.CarNumber" />
                    <Column Title="司机姓名" @bind-Field="@model.Driver" />
                    <Column Title="所属公司" @bind-Field="@model.Company" />
                    <Column Title="手机号" @bind-Field="@model.PhoneNumber" />
                    <Column Title="申请人" @bind-Field="@model.ApplyName" />
                    <Column Title="审核通过" @bind-Field="@model.IsPass" >
                        <Tag Color="@(model.IsPass.Equals(PassType.Yes)?"green" :"red")">@EnumExtension.GetEnumDescription(model.IsPass)</Tag>
                    </Column>
                    <Column Title="是否放行" @bind-Field="@model.IsRelease" >
                        <Tag Color="@(model.IsRelease.Equals(true)?"green" :"red")">@(model.IsRelease.Equals(false)? EnumExtension.GetEnumDescription(YONType.No) : EnumExtension.GetEnumDescription(YONType.Yes))</Tag>
                    </Column>
                    <Column Title="创建时间" @bind-Field="@model.CreatedTime" Format="@SystemConstant.DateTimeFormat" Sortable />
                    <ActionColumn>
                        <Space>
                            <ResourceAuthorize ResourceKey="cars_manager_info_edit">
                                <SpaceItem><Button Type="@ButtonType.Primary" Size="@SystemConstant.OperationButtonSize" OnClick="()=>OnEditClick(model.Id)">编辑</Button></SpaceItem>
                            </ResourceAuthorize>
                            <ResourceAuthorize ResourceKey="cars_manager_info_pass">
                                <SpaceItem><Button Type="@ButtonType.Primary" Size="@SystemConstant.OperationButtonSize" OnClick="()=>OnPassClick(model.Id)">审核</Button></SpaceItem>
                            </ResourceAuthorize>
                            <ResourceAuthorize ResourceKey="cars_manager_info_delete">
                                <SpaceItem><Button Type="@ButtonType.Primary" Size="@SystemConstant.OperationButtonSize" Danger OnClick="()=>OnDeleteClick(model.Id)">删除</Button></SpaceItem>
                            </ResourceAuthorize>
                        </Space>
                    </ActionColumn>
                </RowTemplate>
            </Table>
        </ChildContent>
    </PageContainer>
</div>
